cmake_minimum_required(VERSION 3.16)

project(kylin-os-manager-test LANGUAGES CXX)

set(TOP_DIR ${CMAKE_CURRENT_LIST_DIR}/../)
set(TEST_TOP_DIR ${CMAKE_CURRENT_LIST_DIR})
add_subdirectory(${TOP_DIR}/3rdparty third_party_binary_dir)
add_subdirectory(${TOP_DIR}/plugins plugins_binary_dir)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

add_executable(${PROJECT_NAME})

target_compile_options(${PROJECT_NAME} PRIVATE -Wall -g -rdynamic)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11)

find_package(Qt5 COMPONENTS Widgets REQUIRED)
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Widgets)

target_link_libraries(${PROJECT_NAME} PRIVATE dl)

find_package(PkgConfig REQUIRED)
pkg_check_modules(KYSDKQTWIDGETS_PKG kysdk-qtwidgets)
target_include_directories(${PROJECT_NAME} PRIVATE ${KYSDKQTWIDGETS_PKG_INCLUDE_DIRS})
target_link_directories(${PROJECT_NAME} PRIVATE ${KYSDKQTWIDGETS_PKG_LIBRARY_DIRS})
target_link_libraries(${PROJECT_NAME} PRIVATE ${KYSDKQTWIDGETS_PKG_LIBRARIES})

target_include_directories(${PROJECT_NAME} PRIVATE ${TOP_DIR}/3rdparty/kyplugin)
target_link_libraries(${PROJECT_NAME} PRIVATE kyplugin)

set(SRCS
    "${TEST_TOP_DIR}/main.cpp"
    "${TEST_TOP_DIR}/test_kymanager_widget.cpp"
    "${TEST_TOP_DIR}/test_plugin_manager.cpp"
    "${TOP_DIR}/interface/kymanager_plugin.cpp")

target_include_directories(${PROJECT_NAME} PRIVATE ${TOP_DIR}/interface)
target_sources(${PROJECT_NAME} PRIVATE ${SRCS})